#!/bin/sh

for i in $PLIBDIRS # $PLIBDIRS is exported in 2createpackages
do
	[ -d $i ] || continue
	if [ -e ${i}/libpoppler-glib.so.8 ] ; then
		ln -sv libpoppler-glib.so.8 ${i}/libpoppler-glib.so.4 2>/dev/null
		ln -sv libpoppler-glib.so.8 ${i}/libpoppler-glib.so.5 2>/dev/null
		ln -sv libpoppler-glib.so.8 ${i}/libpoppler-glib.so.6 2>/dev/null
		ln -sv libpoppler-glib.so.8 ${i}/libpoppler-glib.so.7 2>/dev/null
	elif [ -e ${i}/libpoppler-glib.so.7 ] ; then
		ln -sv libpoppler-glib.so.7 ${i}/libpoppler-glib.so.4 2>/dev/null
		ln -sv libpoppler-glib.so.7 ${i}/libpoppler-glib.so.5 2>/dev/null
		ln -sv libpoppler-glib.so.7 ${i}/libpoppler-glib.so.6 2>/dev/null
	elif [ -e ${i}/libpoppler-glib.so.6 ] ; then
		ln -sv libpoppler-glib.so.6 ${i}/libpoppler-glib.so.3 2>/dev/null
		ln -sv libpoppler-glib.so.6 ${i}/libpoppler-glib.so.4 2>/dev/null
		ln -sv libpoppler-glib.so.6 ${i}/libpoppler-glib.so.5 2>/dev/null
	elif [ -e ${i}/libpoppler-glib.so.5 ] ; then
		ln -sv libpoppler-glib.so.5 ${i}/libpoppler-glib.so.2 2>/dev/null
		ln -sv libpoppler-glib.so.5 ${i}/libpoppler-glib.so.3 2>/dev/null
		ln -sv libpoppler-glib.so.5 ${i}/libpoppler-glib.so.4 2>/dev/null
	elif [ -e ${i}/libpoppler-glib.so.4 ] ; then
		ln -sv libpoppler-glib.so.4 ${i}/libpoppler-glib.so.2 2>/dev/null
		ln -sv libpoppler-glib.so.4 ${i}/libpoppler-glib.so.3 2>/dev/null
	fi
done

# 7MB in here, delete it...
[ -d usr/share/poppler ] && rm -rf usr/share/poppler/*
